<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function arr(nums) {
      let m = 0, n = 0;
      // 异或运算，得到两结果数字的抑或运算
      nums.forEach(num => {
        m ^= num;
      });
      let d = m & -m;
      nums.forEach(num => {
        num & d ? n ^= num : '';
      });
      let n1 = n ^ m;
      return [n, n1]
    };
    console.log(arr());
  </script>
</body>

</html>